import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int count = 0;
        while(n != 0) {
            if ((n & 1) != 0) {
                count++;
            }
            n = n>>1;
        }

        System.out.println(count);


        for (int i = 0; i < 32 ; i++) {
            if (((n >> i) & 1) != 0) {
                count++;
            }
        }
        System.out.println(count);



        while (n != 0) {
            count++;
            n = n & (n-1);
        }

        System.out.println(count);


        int i = input.nextInt();
        for (int j = 31; j >=1; j-=2) {
            System.out.print(((i >>> j) & 1 ) + " ");
        }
        System.out.println();
        for (int j = 30; j >=0; j-=2) {
            System.out.print(((i >>> j) & 1 ) + " ");
        }

    }
}
